package logic

import (
	"context"
	"time"

	"gozerogateway/rpc/market/internal/svc"
	"gozerogateway/rpc/market/marketclient"

	"github.com/zeromicro/go-zero/core/logx"
)

type FlowStatLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewFlowStatLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FlowStatLogic {
	return &FlowStatLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *FlowStatLogic) FlowStat(in *marketclient.FlowStatReq) (*marketclient.FlowStatResp, error) {
	// todo: add your logic here and delete this line

	todayList := []int64{} //empty []
	for i := 0; i <= time.Now().Hour(); i++ {
		todayList = append(todayList, 0)
	}
	yesterdayList := []int64{}
	for i := 0; i <= 23; i++ {
		yesterdayList = append(yesterdayList, 0)
	}
	return &marketclient.FlowStatResp{
		Today:     todayList,
		Yesterday: yesterdayList,
	}, nil
}
